package com.xiaozhen.jt809.handler.client;

import com.xiaozhen.common.redis.utils.RedisUtils;
import com.xiaozhen.jt809.constant.JT809BusinessConstant;
import com.xiaozhen.jt809.domain.JT809MessageInfo;
import com.xiaozhen.jt809.handler.MyHandler;
import com.xiaozhen.jt809.service.MsgHandleService;
import com.xiaozhen.jt809.utils.ResponseUtil;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/9/17 8:54
 * @description:
 */
@Slf4j
@Service
public class DownDisconnectHandler implements MyHandler {

    @Autowired
    private MsgHandleService msgHandleService;

    @Override
    public void handler(ChannelHandlerContext ctx, JT809MessageInfo messageInfo) {
        JT809MessageInfo messageInfo2 = msgHandleService.getMessageInfo(ctx, "从链路注销请求消息");
        byte[] verifyCode = new byte[4];
        JT809MessageInfo responseMessage = ResponseUtil.responseMessage(messageInfo2,
                JT809BusinessConstant.DOWN_DISCONNECT_REQ,
                verifyCode);
        ctx.writeAndFlush(responseMessage);
    }
}
